﻿
namespace CommandLib
{
    /// <summary>
    /// 抽像索引类
    /// </summary>
    public abstract class ClassIndex
    {
        public object this[string index]
        {
            get
            {
                object result = null;
                var pro = this.GetType().GetProperties();
                foreach (var item in pro)
                {
                    if (index == item.Name){result = item.GetValue(this); }
                }
                return result;
            }
            set
            {
                var pro= this.GetType().GetProperties();
                foreach (var item in pro)
                {
                    if (index == item.Name){item.SetValue(this, value, null);}
                }

            }

        }
    }
}
